package br.com.massai.model.beans;

import java.io.IOException;
import java.io.Serializable;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import br.com.massai.model.entity.Collaborator;
import br.com.massai.model.exceptions.SystemException;

@ManagedBean
@ViewScoped
public class LoginBean implements Serializable {

	private static final long serialVersionUID = -3619629901624988876L;

	private Collaborator user;

	@EJB private SessionBean session;

	public LoginBean() {
		this.user = new Collaborator();
	}

	public void login() throws SystemException, IOException {
		session.login(this.user);
	}

	public Collaborator getUser() {
		return user;
	}

	public void setUser(Collaborator user) {
		this.user = user;
	}
}